//封装获取频道列表的数据
import { useState, useEffect } from "react"
import { channelAPI } from "@/apis/article"

function useChannels() {
  const [channellist, setChannelList] = useState([])
  useEffect(() => {
    const getChannelList = async () => {
      const res = await channelAPI()
      setChannelList(res.data.channels)
    }
    getChannelList()
  }, [])
  return {
    channellist
  }
}

export { useChannels }